﻿
namespace SanguoSharp.Server
{
    public abstract class PlayableCard : Card
    {
        protected PlayableCard(Game game, int id, CardType type, CardSuit suit, CardRank rank)
            : base(game, id, type, suit, rank)
        {
        }

        public override void Play()
        {
            if (Owner == null)
                throw new BadCardException();
            Owner.CheckPlayCard(Type);

            OnPlay();
        }
        public override void PlayVirtually(Card card)
        {
            if (Owner == null)
                throw new BadCardException();
            Owner.CheckPlayCard(Type);

            OnPlayVirtually(card);
        }

        protected abstract void OnPlay();
        protected abstract void OnPlayVirtually(Card card);
    }
}